#ifndef VENUS_COMMON_MICROS_H
#define VENUS_COMMON_MICROS_H

#define RET(b)					\
	if ( !(b) ) return;

#define F_RET(b)				\
	if ( !(b) ) return false;

#define V_RET(b) F_RET(b)

#define T_RET(b)				\
	if ( (b) ) return true;

#define C_BREAK_R(b)			\
	if ( (b) ) break;			\
	else return 0;

#define C_BREAK(b)				\
	if ( (b) ) break;

#define SAFE_RELEASE(p)			\
	if ( NULL != p ) {			\
	delete p;					\
	p = NULL;					\
	}

#define SAFE_RELEASE_A(p)		\
	if ( NULL != p ) {			\
	delete[] p;					\
	p = NULL;					\
	}

#define TWOFOLD(x) ((x) + (x) )
#define TRIPLE(x) ((x) + (x) +(x))

#define REPEAT_1(STEP) STEP(0)
#define REPEAT_2(STEP) REPEAT_1(STEP); STEP(1)
#define REPEAT_3(STEP) REPEAT_2(STEP); STEP(2)

#define MAKE_PIXEL( red, green, blue ) (red) + ( (green) << 8) + ( (blue) << 16)

#endif // VENUS_COMMON_MICROS_H
